home *** CD-ROM | disk | FTP | other *** search
/ Enter 2003: The Beautiful Scenery / enter-parhaat-2003.iso / files / frendz.exe / frendz.dcr / Scripts_58_Application Layer.ls < prev    next >
Encoding:
Text File  |  2002-12-31  |  4.3 KB  |  135 lines

  1. global gMessageBox, gInterAni, gAniPairRed, gAniPairBlue, gAniPairWon, gAniPairLost, gDelayButton, gAniPairSeq, gNextChannel
  2.  
  3. on gameError text
  4.   sprite(83).loc = point(270, 240)
  5.   gDelayButton = -1
  6.   gMessageBox.mb_BoxSize(point(75, 115), point(75, 115), point(95, 125), 230, 145, 230, 145)
  7.   gMessageBox.mb_text(text)
  8. end
  9.  
  10. on gameErrorBig text
  11.   sprite(83).loc = point(270, 240)
  12.   gDelayButton = -1
  13.   gMessageBox.mb_BoxSize(point(75, 80), point(75, 80), point(95, 90), 230, 175, 230, 175)
  14.   gMessageBox.mb_text(text)
  15. end
  16.  
  17. on setintermission
  18.   gInterAni = [["wave", "pop", "chase", "slide", "dance"]]
  19. end
  20.  
  21. on intermission
  22.   sprite(83).member = "SkipUp"
  23.   gDelayButton = the timer + (2 * 60)
  24.   sprite(83).loc = point(-200, 315)
  25.   gMessageBox.mb_BoxSize(point(35, 60), point(35, 60), point(50, 125), 315, 275, 315, 275)
  26. end
  27.  
  28. on setMainAnimations
  29.   gAniPairRed = [[["bounce", "grumblens"], ["flip", "grumblens"], ["dance", "grumblens"], ["morefrendz", "grumblens"], ["woohoo", "grumblens"], ["haha", "grumblens"], ["bust", "grumblens"], ["lose", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"]]]
  30.   gAniPairBlue = [[["bounce", "grumblens"], ["flip", "grumblens"], ["dance", "grumblens"], ["morefrendz", "grumblens"], ["woohoo", "grumblens"], ["haha", "grumblens"], ["bust", "grumblens"], ["move", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"], ["flipns", "grumblens"], ["bouncens", "grumblens"], ["dancens", "grumblens"]]]
  31.   gAniPairLost = [[["ohno", "bouncens"], ["ohno", "flipns"], ["ohno", "dancens"]]]
  32.   gAniPairWon = [[["bounce", "grumblens"], ["flip", "grumblens"], ["dance", "grumblens"], ["woohoo", "grumblens"], ["haha", "grumblens"]]]
  33. end
  34.  
  35. on playFlashAnimationOne theFrame, num, withSound
  36.   put theFrame
  37.   sprite(num).goToFrame(theFrame)
  38.   put sprite(num).frame
  39.   sprite(num).play()
  40.   return theFrame
  41. end
  42.  
  43. on playFlashAnimation count, num, withSound
  44.   put count
  45.   frame = pickRandom(count)
  46.   put frame
  47.   sprite(num).goToFrame(frame)
  48.   put sprite(num).frame
  49.   sprite(num).play()
  50.   return frame
  51. end
  52.  
  53. on playFlashAnimationPair count, Num1, Num2, withSound, inSeq
  54.   if inSeq = VOID then
  55.     inSeq = 0
  56.   end if
  57.   if inSeq then
  58.     if gAniPairSeq = VOID then
  59.       gAniPairSeq = 1
  60.     else
  61.       gAniPairSeq = gAniPairSeq + 1
  62.       if gAniPairSeq > count[1].count() then
  63.         gAniPairSeq = 1
  64.       end if
  65.     end if
  66.     frames = count[1][gAniPairSeq]
  67.   else
  68.     put count
  69.     frames = pickRandom(count)
  70.     put frames
  71.   end if
  72.   sprite(Num1).goToFrame(frames[1])
  73.   put sprite(Num1).frame
  74.   sprite(Num1).play()
  75.   sprite(Num2).goToFrame(frames[2])
  76.   put sprite(Num2).frame
  77.   sprite(Num2).play()
  78.   return frames
  79. end
  80.  
  81. on playFlashAnimationPairWhich count, Num1, Num2, withSound, which
  82.   put count
  83.   frames = count[1][which]
  84.   put frames
  85.   sprite(Num1).goToFrame(frames[1])
  86.   put sprite(Num1).frame
  87.   sprite(Num1).play()
  88.   sprite(Num2).goToFrame(frames[2])
  89.   put sprite(Num2).frame
  90.   sprite(Num2).play()
  91. end
  92.  
  93. on pickRandom theList
  94.   if theList.count = 1 then
  95.     pvInitRandomList(theList)
  96.   end if
  97.   theCounts = theList[2]
  98.   numItems = theCounts.count
  99.   r = random(numItems)
  100.   r2 = r
  101.   best = 1000000
  102.   repeat with i = 1 to numItems
  103.     if (theList[3] <> r2) and (theCounts[r2] < best) then
  104.       best = theCounts[r2]
  105.       r = r2
  106.     end if
  107.     r2 = (r2 mod numItems) + 1
  108.   end repeat
  109.   theCounts[r] = theCounts[r] + 1
  110.   theList[3] = r
  111.   return theList[1][r]
  112. end
  113.  
  114. on pvInitRandomList theList
  115.   n = theList[1].count
  116.   temp = []
  117.   repeat with i = 1 to n
  118.     append(temp, 0)
  119.   end repeat
  120.   append(theList, temp)
  121.   append(theList, -1)
  122. end
  123.  
  124. on playSoundFreeChannel theSound
  125.   if gNextChannel = VOID then
  126.     gNextChannel = 3
  127.   else
  128.     gNextChannel = gNextChannel + 1
  129.     if gNextChannel > 7 then
  130.       gNextChannel = 3
  131.     end if
  132.   end if
  133.   puppetSound(gNextChannel, theSound)
  134. end
  135.